package main

import (
	"flag"
	"net/http"
	"strconv"
	"time"

	"github.com/golang/glog"

	"display/apiserver/pkg/config"
	"display/apiserver/pkg/filter"
	routers "display/apiserver/pkg/router"
)

func main() {
	config.GetConfig().AddFlags(flag.CommandLine)
	flag.Parse()
	defer glog.Flush()

	server := &http.Server{
		Handler:      filter.GeneralFilter(routers.RegisterRouter()),
		Addr:         ":" + strconv.FormatInt(config.GetConfig().Port, 10),
		WriteTimeout: 15 * time.Second,
		ReadTimeout:  15 * time.Second,
	}
	glog.Info("apisever Listen On " + server.Addr)
	glog.Fatal(server.ListenAndServe())
}
